﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel.Activation;
using System.ServiceModel;
using CalendarService.Utils;

namespace CalendarService.Service
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class Api:IApi
    {
        string data;
        public string GetData()
        {
            using (var proxy = new ChannelUtil<ITest1>("http://localhost:2144/ServiceHost/Test1.svc"))
            {
                //data = proxy.Channel.sayGoodbye();
            }
    
            return data;
        }

        public string PutData(string service, string param)
        {
            if (service.Equals("sayGoodbye"))
            {
                using (var proxy = new ChannelUtil<ITest1>("http://localhost:2144/ServiceHost/Test1.svc"))
                {
                    data = proxy.Channel.sayGoodbye(param);
                }
                return data;
            }
            return "false";
        }
    }
}